﻿﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>项目管理</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.5.8/css/sm.min.css">
    <link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.5.8/css/sm-extend.min.css">
    <link rel="stylesheet" href="//at.alicdn.com/t/font_1470730253_188452.css">
    <link href="/View_Mobile/CSS/szhlextend.css?ver=20160904" rel="stylesheet" />
    <!--<link rel="stylesheet" href="/View_Mobile/CSS/animate.css">-->

    <style type="text/css">
        .ms-controller, [ms-controller] {
            display: none;
        }
    </style>
</head>
<body ms-controller="RWList">
    <div class="page-group">
        <div class="page page-current" id="pageindex1">
            <div class="buttons-tab">
                <a href="#" ms-if="DataID=='-1'" ms-on-click="getdata(1)" class="tab-link button external" ms-class-1="active:type=='1'">我创建的</a>
                <a href="#" ms-if="DataID=='-1'" ms-on-click="getdata(2)" class="tab-link button external" ms-class-1="active:type=='2'">我负责的</a>
                <a href="#" ms-if="DataID=='-1'" ms-on-click="getdata(3)" class="tab-link button external" ms-class-1="active:type=='3'">我参与的</a>
                <a href="#" ms-if="DataID!='-1'" class="tab-link button external active">项目管理</a>

            </div>

            <div class="content infinite-scroll infinite-scroll-bottom touchcontent" data-distance="50" style="margin-top:2rem" id="touchcontent">
                <div class="list-container" style="min-height:500px">

                    <div class="card facebook-card animated fadeInUp" ms-repeat-el="ctData">
                        <div class="ribbon-wrapper-green"><div ms-class-1="ribbon-green:el.Status==0" ms-class-2="ribbon-red:el.Status==1">{{el.Status==0?'正在进行':'已结束'}}</div></div>
                        <!--<div class="card-header no-border" ms-on-click="showdetil(el)">
                            <div class="facebook-avatar"><img ms-src="/ViewV5/Base/DownFile.aspx?type=TX&user={{el.CRUser}}" style="border-radius: 3px;width:32px;height:32px"><div class="cadename">{{ComFunJS.convusers(el.CRUser)}}</div></div>-->
                            <!--<div class="facebook-date" style="margin-left:0px;">{{$.timeago(el.CRDate)}}</div>-->
                            <!--<div class="facebook-date">{{el.CRDate|date("MM月dd日")}}</div>
                            <div class="facebook-date" style="min-height: 1.5rem;">{{covtitle(el.XMMC)}}</div>
                        </div>-->
                        <div class="card-header no-border" ms-on-click="showdetil(el)">
                            <div class="facebook-avatar">
                                <img ms-src="/ViewV5/Base/DownFile.aspx?type=TX&user={{el.CRUser}}" width="40" class="border-r">
                            </div>
                            <div class="facebook-date head-ft16">{{ComFunJS.convusers(el.CRUser)}}<span class="ml10 c999 ft14" ms-if="!el.isfold">{{$.timeago(el.CRDate)}}</span></div>
                            <div class="facebook-date head-ft16" ms-if="el.isfold"><span class="c999 ft14">{{el.CRDate|date("MM月dd日")}}</span></div>
                            <div class="facebook-date" ms-if="!el.isfold">
                                <span class="c999 title-item">项目名称：</span>
                                <span>{{covtitle(el.XMMC)}}</span>
                            </div> 
                            <div style="clear:both"></div>
                        </div>
                        <div class="card-content" ms-visible="el.isfold">
                            <div class="card-item">
                                <span class="c999 title-item">项目名称：</span>
                                <span>{{covtitle(el.XMMC)}}</span>
                            </div>
                            <div class="card-item">
                                <span class="c999 title-item">负责人：</span>
                                <span>{{ComFunJS.convusers(el.XMFZR)}}</span>
                            </div>
                            <div class="card-item">
                                <span class="c999 title-item">团队成员：</span>
                                <span>{{ComFunJS.convusers(el.XMCYR)}}</span>
                            </div>
                            <div class="card-item">
                                <span class="c999 title-item">项目描述：</span>
                                <span>{{el.XMMS}}</span>
                            </div>
                            <div class="card-item">
                                <span class="c999 title-item">项目类型：</span>
                                <span>{{el.TypeName}}</span>
                            </div>
                            <div class="card-item">
                                <span class="c999 title-item">项目进度：</span>
                                <span>{{el.XMJD}}</span>
                            </div> 
                            <div class="card-content-inner" style="padding-top: 0; padding-bottom: 0.1rem;" ms-if="el.Files">
                                <ul class="filelist">
                                    <li ms-repeat-file="el.FileList">
                                        <img ms-class="mall_pcp:ComFunJS.isPic(file.FileExtendName)" class="" ms-on-click="viewfile(file)" ms-src="/ViewV5/Base/DownFile.aspx?fileId={{file.ID}}" />
                                        <span class="fileinfo" ms-if="!ComFunJS.isPic(file.FileExtendName)">{{file.Name}}</span>
                                    </li>
                                </ul>
                            </div>
                            <div ms-visible="el.PLList.size()>0">
                                <div class="lookright-box">
                                    <div class="menu-general">
                                        <ul>
                                            <li class="active">
                                                <a>评论</a>
                                            </li>
                                        </ul>
                                    </div>
                                </div>

                                <div id="map">
                                    <!--跟进-->
                                    <div style="display: block;">
                                        <!--评论样式-->
                                        <div class="crm-dt" ms-repeat-pl="el.PLList">
                                            <span class="crm-yuan"></span>
                                            <div class="crm-dt-cont">

                                                <div class="m5">
                                                    <p class="c999">{{pl.CRUserName}} <span class=" ft14 pull-right">{{pl.CRDate|date("MM月dd日")}}</span></p>
                                                    <h3 class="crm-xg ft14 mt5" style="word-break:break-all;word-wrap:break-word;">
                                                        {{ComFunJS.bqhContent(pl.MSGContent)|html}}
                                                    </h3>
                                                    <ul class="filelist">
                                                        <!--repeat428537517786-->
                                                        <li ms-repeat-file="pl.FileList">
                                                            <img ms-class="mall_pcp:ComFunJS.isPic(file.FileExtendName)" class="" ms-on-click="viewfile(file)" ms-src="/ViewV5/Base/DownFile.aspx?fileId={{file.ID}}" />
                                                            <span class="fileinfo" ms-if="!ComFunJS.isPic(file.FileExtendName)">{{file.Name}}</span>
                                                        </li>
                                                    </ul>
                                                    <p></p><div class="item-after pfdv">{{pf(pl.Points)|html}}</div><p></p>


                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--<div class="list-block media-list" style="margin-top: 5px;">
                                <ul>
                                    <li ms-repeat-pl="el.PLList">
                                        <div class="item-content">
                                            <div class="item-media" style="display:block">
                                                <img ms-src="/ViewV5/Base/DownFile.aspx?type=TX&user={{pl.CRUser}}" style="border-radius: 3px;width:34px;height:30px" onerror="javascript: this.src = '/Upload/TX/def.jpg'">
                                                <span style="display: block; font-size: .6rem; text-align: center; color:gray">{{pl.CRUserName}}</span>
                                            </div>
                                            <div class="item-inner" style=" padding-top: .4rem;">
                                                <div class="item-subtitle" style="color: #5f646e; font-size: .7rem; white-space: normal;">{{ComFunJS.bqhContent(pl.MSGContent)|html}}</div>
                                                <div class="item-title-row" style="font-size: .6rem; margin-top: 5px;">
                                                    <div class="item-title" style="color:gray">{{$.timeago(pl.CRDate)}}</div><span></span>
                                                    <div class="item-after pfdv"> {{pf(pl.Points)|html}}</div>
                                                </div>
                                            </div>
                                        </div>
                                    </li>
                                </ul>
                            </div>-->
                            <div class="buttons-tab list-op">
                                <a class="tab-link button external" ms-click="pl(el)">
                                    <i class="iconfont icon-xiaoxi"></i>跟进
                                </a>
                                <a class="tab-link button external" ms-if="el.CRUser==nowuser" style="" ms-click="vieww(el)">
                                    <i class="iconfont icon-bianji"></i>编辑
                                </a>
                            </div>
                        </div>
                         
                    </div>
                    <div class="card facebook-card animated" ms-if="ctData.size()==0">
                        <div class="card-header no-border">
                            {{loadtip}}
                        </div>
                    </div>
                </div>
                <div class="infinite-scroll-preloader">
                    <div class="preloader"></div>
                </div>
            </div>

            <!--<span class="animated fadeIn" ms-if="DataID=='-1'" ms-click="addXMGL()" id="plus_btn" style="z-index:99998;opacity:.9"><img src="../images/plus_icon.png"></span>
            <span class="animated fadeIn" ms-if="DataID=='-1'" ms-click="changefold()" id="plus_list" style="z-index:99998;opacity:.9"><img ms-attr-src="'../images/'+(isfold?'rwglss':'rwglzk')+'.png'"></span>-->
            <div class="right-panel">
                <ul>
                    <li ms-if="DataID=='-1'">
                        <a class="mod-li-icon" ms-click="show()"><img src="../images/plus-serch.png"></a>
                    </li>
                    <li ms-if="DataID=='-1'">
                        <!--<a class="mod-li-icon" ms-if="DataID!='-1'" ms-click="viewall()"><img src="/View_Mobile/images/plus-zhankai.png"></a>-->
                        <a class="mod-li-icon"  ms-click="changefold()"><img ms-attr-src="'/View_Mobile/images/'+(isfold?'plus-zhedie':'plus-zhankai')+'.png'" src="/View_Mobile/images/plus-zhedie.png"></a>
                    </li>
                    <li ms-if="DataID=='-1'">
                        <a class="mod-li-icon" ms-click="addXMGL()"><img src="/View_Mobile/images/plus-add.png"></a>
                    </li>

                </ul>

            </div>
        </div>
        <div class="page" id="pageindex2">
        </div>
        <div class="search-top" ms-if="isShow">

            <div class="searchbar searchbar-active">
                <a class="searchbar-cancel" ms-click="GetList()">搜索</a>
                <a class="searchbar-cancel search-close" ms-click="show()"><i class="iconfont icon-cuo"></i></a>
                <div class="search-input">
                    <label class="icon icon-search" for="search"></label>
                    <input type="search" id="search" placeholder="搜索项目名称" ms-duplex="search">
                </div>
            </div>

        </div>
    </div>
    <script src="/View_Mobile/JS/layer/layer.m.js"></script>
    <script type='text/javascript' src='//g.alicdn.com/sj/lib/zepto/zepto.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='//g.alicdn.com/msui/sm/0.5.8/js/sm.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='//g.alicdn.com/msui/sm/0.5.8/js/sm-extend.min.js' charset='utf-8'></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
    <script src="/View_Mobile/JS/touch/toucher.js"></script>
    <script src="/View_Mobile/JS/avalon.mobile.min.js"></script>
    <script src="/View_Mobile/JS/raty/jquery.raty.js?v=1.3"></script>
    <script src="/View_Mobile/JS/ComFunJS.js?jsver=20160425"></script>
    <script>

        var model = avalon.define({
            $id: "RWList",
            ctData: [],//数据源
            loading: false,
            loadtip: "",//切换页时显示信息
            nowuser: ComFunJS.getnowuser(),//当前用户
            isfold: localStorage.getItem("RWListisfold") == "Y" ? true : false,//是否折叠显示
            changefold: function () {
                model.isfold = !model.isfold;
                model.ctData.forEach(function (item) {
                    item.isfold = model.isfold;
                })
                localStorage.setItem("RWListisfold", model.isfold ? "Y" : "N");
            },//改变折叠状态
            covtitle: function (title) {
                return ComFunJS.convstr($("<div>" + title + "</div>").text(), 40);
            },//转化 TITLE信息
            showdetil: function (item) {
                item.isfold = !item.isfold
            },//展开显示信息
            search: "",
            isShow: false,
            show: function () {
                if (model.search) {
                    model.search = "";
                    model.GetList();
                }
                if (model.isShow)
                    model.isShow = false;
                else {
                    model.isShow = true;
                    $("#search").focus();
                }
            },
            GetList: function () {
                model.ctData.clear();
                model.loadtip = "";
                model.page = 1;
                model.loadMore();
            },
            page: 1,
            pagecount: 8,
            DataID: ComFunJS.getQueryString("ID", "-1"),//数据ID
            type: 1,//

            vieww: function (el) {
                //路由加载
                window.location = "/View_Mobile/UI/BASE/APP_MOBIL_WF.html?FormCode=XMGL&id=" + el.ID + "&r=" + Math.random();
            },
            addXMGL: function (el) {
                window.location = "/View_Mobile/UI/BASE/APP_MOBIL_WF.html?FormCode=XMGL&r=" + Math.random();
            },
            loadMore: function () {
                if (model.loading) return;
                model.loading = true;
                $.getJSON("/API/VIEWAPI.ashx?Action=XMGL_GETXMGLDATA&r=" + Math.random(), { "p": model.page, P2: model.type, ID: model.DataID, Content: model.search }, function (r) {
                    model.loading = false;
                    if (r.ErrorMsg == "") {
                        for (var i = 0; i < r.Result.length; i++) {
                            r.Result[i].isfold = model.isfold;
                            if (model.DataID != "-1") {//如果有数据ID，则展开显示
                                r.Result[i].isfold = true;
                            }
                        }
                        model.ctData.pushArray(r.Result);
                        //判断是否加载完毕
                        if (r.Result.length < model.pagecount) {
                            // 加载完毕，则注销无限加载事件，以防不必要的加载
                            $.detachInfiniteScroll($('.infinite-scroll'));
                            // 删除加载提示符
                            $('.infinite-scroll-preloader').remove();
                            if (model.ctData.size() == 0) {
                                model.loadtip = '没有找到数据哦'
                            }
                            return;
                        }
                        $.refreshScroller();
                        model.page += 1;
                        if (model.ctData.size() == 0) {
                            model.loadtip = '没有找到数据哦'
                        }
                    }

                });

            },
            viewfile: function (file) {
                if (ComFunJS.isPic(file.FileExtendName)) {
                    ComFunJS.viewbigimg(this)
                    return;
                }
                if (ComFunJS.isOffice(file.FileExtendName) && file.ISYL == "Y") {
                    window.location = file.YLUrl;
                    return;
                }
            },//文件查看方法
            pl: function (el) {
                ComFunJS.showCommentNew(function (result) {

                    $.getJSON('/API/VIEWAPI.ashx?Action=XTGL_ADDCOMENT&r=' + Math.random(), { "P1": result.comment, "Points": result.point, "MsgType": "XMGL", "MsgLYID": el.ID }, function (resultData) {

                        if (resultData.ErrorMsg == "") {
                            el.PLList.push(resultData.Result);
                            ComFunJS.winsuccess("评论成功");
                        }
                    })

                }, false);
            },
            moreaction: function (el, dom, index) {
                var actions = [{ text: '请选择', label: true }];
                if (el.CRUser == model.nowuser && el.Status == 0) {
                    actions.push({
                        text: '编辑',
                        onClick: function () {
                            model.vieww(el);
                        }
                    })
                    //actions.push({
                    //    text: '删除',
                    //    color: 'danger',
                    //    onClick: function () {
                    //        model.DELXMGL(el)
                    //    }
                    //})

                }
                var qx = [{ text: '取消', bg: 'danger' }];
                var groups = [actions, qx];
                $.actions(groups);

                $(".modal-overlay").one('click', function () {
                    $(this).remove();
                    $(".actions-modal").remove();

                })
            },//更多操作的方法
            pf: function (str) {
                if (str) {
                    var html = '<div></div>';
                    var html1 = $(html).raty({
                        readOnly: true,
                        score: str * 1 / 20
                    }).html();
                    return html1;
                }
                else {
                    return '';
                }
            },
            getdata: function (type) {
                $.attachInfiniteScroll($('.infinite-scroll'))
                model.type = type;
                model.ctData.clear();
                model.loadtip = "正在加载数据... ...";
                model.page = 1;
                model.loadMore();
            },
            DELXMGL: function (item) {
                $.confirm('确认要删除吗？', function () {
                    $.getJSON('/API/VIEWAPI.ashx?Action=XMGL_DELXMGL', { "P2": item.ID }, function (result) {
                        if (result.ErrorMsg == "") {
                            ComFunJS.winsuccess("删除成功");
                            model.ctData.remove(item);
                            if (model.ctData.size() == 0) {
                                model.loadtip = '没有找到数据哦'
                            }
                        }
                    })
                })

            },
            completeDB: function (el) {//修改待办状态
                $.getJSON('/API/VIEWAPI.ashx?Action=XMGL_COMPLETEXMGL', { "P1": el.ID, "P2": 1 }, function (result) {
                    if (result.ErrorMsg == "") {
                        el.RWStatus = 1;
                        model.ctData.remove(el);
                        ComFunJS.winsuccess("操作成功");
                    }
                })
            },
            wxchat: function (el) {
                ComFunJS.openEntChat(el.CRUser + "," + el.RWFZR + "," + el.RWCYR, "任务群组");
            }
        })
        avalon.ready(function () {
            // 注册'infinite'事件处理函数
            $(document).on('infinite', '.infinite-scroll-bottom', function () {
                model.loadMore();
            });

            $.init();
            if (model.DataID == "-1") {//如果参数中没有数据ID，则默认抓取当前用户数据
                model.type = 1;
                util.toucher(document.getElementById('touchcontent'))
                    .on('swipeLeft', '.list-container', function () {
                        model.type = model.type == 3 ? 1 : model.type * 1 + 1;
                        model.getdata(model.type)
                        return false;
                    })
                    .on('swipeRight', '.list-container', function () {
                        model.type = model.type == 1 ? 3 : model.type * 1 - 1;
                        model.getdata(model.type)
                        return false;
                    })//左右滑动事件
            }
            model.getdata(model.type);
            //初始化微信配置
            //ComFunJS.initwxConfig();
        })
    </script>
</body>

</html>